***Out of Sight, Out of Mind?***
***Tables in Revised version, appendix***
***Last update: 02.06.2021 GC

clear
clear mata
clear matrix
cap log close
set more off

set matsize 10000
set maxvar 30000
set max_memory 32g, permanently

log using "replication_tables_appendix.log", replace


*load data
use "final_data.dta", clear

summ
tab electionType

*labels for tables

la var Dwalk_1 "$\Delta$ Walking time"
la var Dwalk_3 "$\Delta$ Walking time"
la var Dwalk_5 "$\Delta$ Walking time"

la var Dwalk_center_1 "$\Delta$ Walking time (centroid)"
la var Dwalk_center_3 "$\Delta$ Walking time (centroid)"
la var Dwalk_center_5 "$\Delta$ Walking time (centroid)"

la var Dakp_1 "$\Delta$ AKP vote share"
la var Dakp_3 "$\Delta$ AKP vote share"
la var Dakp_5 "$\Delta$ AKP vote share"

la var Dpop1000_asm_dr_3 "$\Delta$ Congestion"
la var Dpop1000_asm_dr_5 "$\Delta$ Congestion"

la var lograyic09 "PropertyValue2009"

la var dr_number "Number of doctors"
la var pop_inst_mayor "Pre-reform need for doctors"
la var pop_inst_belmeclis "Pre-reform need for doctors"
la var pop_inst_ilgenel "Pre-reform need for doctors"

la var akp_bel_2009 "AKPmayor2009"

la var akp_pc_2009_belmeclis "%AKP2009 MC"
la var time_walk_min_2009_belmeclis "Walk2009"

la var akp_pc_2009_ilgenel "%AKP2009 PC"
la var time_walk_min_2009_ilgenel "Walk2009"

la var Dpopulation_1 "$\Delta$ Population"
la var Dpopulation_3 "$\Delta$ Population"
la var Dpopulation_5 "$\Delta$ Population"

la var Duniversity_1 "$\Delta$ University"
la var Duniversity_3 "$\Delta$ University"
la var Duniversity_5 "$\Delta$ University"

la var Dhospital_pri_1 "$\Delta$ PrivateHospital"
la var Dhospital_pri_3 "$\Delta$ PrivateHospital"
la var Dhospital_pri_5 "$\Delta$ PrivateHospital"

la var Dhospital_pub_1 "$\Delta$ PublicHospital" 
la var Dhospital_pub_3 "$\Delta$ PublicHospital" 
la var Dhospital_pub_5 "$\Delta$ PublicHospital" 

la var Dodr_1 "$\Delta$ ODR"
la var Dodr_3 "$\Delta$ ODR"
la var Dodr_5 "$\Delta$ ODR"

la var Dydr_1 "$\Delta$ YDR"
la var Dydr_3 "$\Delta$ YDR"
la var Dydr_5 "$\Delta$ YDR"

la var medrayic09 "PropertyValue2009" 


* Table A1: Pre-reform need for doctors

*elec_combo=1 2009mayor,2011,2014mayor,2015june
global controls_doktor="Dwalk_1 Dpopulation_1 Duniversity_1 Dhospital_pri_1 Dhospital_pub_1 Dodr_1 Dydr_1 medrayic09"

reg dr_number pop_inst_mayor $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a1.tex", keep(pop_inst_mayor) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES,  Elec2009, M) nonotes 
	
	
*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_doktor="Dwalk_3 Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg dr_number pop_inst_belmeclis $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a1.tex", keep(pop_inst_belmeclis) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES,  Elec2009, MC) nonotes 

*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_doktor="Dwalk_5 Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg dr_number pop_inst_ilgenel $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a1.tex", keep(pop_inst_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 

	
******

*Table A2. health care provision by pre-existing need, core vs. swing	

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june

global controls_doktor="Dwalk_3 Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg dr_number c.pop_inst_belmeclis##i.swing5_2009_belmeclis $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a2.tex", keep(pop_inst_belmeclis swing5_2009_belmeclis c.pop_inst_belmeclis#1.swing5_2009_belmeclis) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 

reg dr_number c.pop_inst_belmeclis##i.swing2_2009_belmeclis $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a2.tex", keep(pop_inst_belmeclis swing2_2009_belmeclis c.pop_inst_belmeclis#1.swing2_2009_belmeclis) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 

*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june

global controls_doktor="Dwalk_5 Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg dr_number c.pop_inst_ilgenel##i.swing5_2009_ilgenel $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a2.tex", keep(pop_inst_ilgenel swing5_2009_ilgenel c.pop_inst_ilgenel#1.swing5_2009_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 
	
reg dr_number c.pop_inst_ilgenel##i.swing2_2009_ilgenel $controls_doktor if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a2.tex", keep(pop_inst_ilgenel swing2_2009_ilgenel c.pop_inst_ilgenel#1.swing2_2009_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC, Elec2014) nonotes 
	
******

* Table A3: test targeting, akp vs. non-akp belediye

*elec_combo=1 2009mayor,2011,2014mayor,2015june
global controls_walk="Dpopulation_1 Duniversity_1 Dhospital_pri_1 Dhospital_pub_1 Dodr_1 Dydr_1 medrayic09"

reg Dwalk_1 c.Dakp_1##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_1 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_1) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, M) nonotes 

reg Dwalk_center_1 c.Dakp_1##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_1 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_1) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, M) nonotes 

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dwalk_3 c.Dakp_3##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_3 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 

reg Dwalk_center_3 c.Dakp_3##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_3 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 	

*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dwalk_5 c.Dakp_5##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_5 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 
	
reg Dwalk_center_5 c.Dakp_5##i.akp_bel_2009 $controls_walk if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a3.tex", keep(Dakp_5 1.akp_bel_2009 1.akp_bel_2009#c.Dakp_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 
	
******

*Table A4. Virtual FHC's

preserve

keep if merge_vfhc==1 //keep only obs. for which we have virtual FHC indicator
keep if year==2011	
tab sanal_asm
tab year
unique school_id_cluster

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dwalk_3 akp_pc_2009_belmeclis $controls_walk if sanal_asm==0 , cluster(school_id_cluster)
outreg2 using "$output/table_a4.tex", keep(akp_pc_2009_belmeclis) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 
	
reg Dwalk_3 c.akp_pc_2009_belmeclis##i.sanal_asm $controls_walk , cluster(school_id_cluster)
outreg2 using "$output/table_a4.tex", keep(akp_pc_2009_belmeclis 1.sanal_asm c.akp_pc_2009_belmeclis#1.sanal_asm) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 
	
	
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
	
reg Dwalk_5 akp_pc_2009_ilgenel $controls_walk if sanal_asm==0 , cluster(school_id_cluster)
outreg2 using "$output/table_a4.tex", keep(akp_pc_2009_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 

reg Dwalk_5 c.akp_pc_2009_ilgenel##i.sanal_asm $controls_walk , cluster(school_id_cluster)
outreg2 using "$output/table_a4.tex", keep(akp_pc_2009_ilgenel 1.sanal_asm c.akp_pc_2009_ilgenel#1.sanal_asm) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 
		
restore
		
****
	
*Table A5. The code is at the end of the dofile, as it uses another dataset.
	

****

* Table A6: Excluding rural districts 

preserve

tab district rural
drop if rural==1

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
global controls_walk3="akp_pc_2009_belmeclis time_walk_min_2009_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_3 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a6.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Neighborhood, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_3 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_center_3 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_center_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, MC) nonotes
	
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
global controls_walk3="akp_pc_2009_ilgenel time_walk_min_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_5 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, PC) nonotes

reg Dakp_5 Dwalk_5 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a6.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Neighborhood, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_5 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Cluster, Poll Station, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_center_5 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a6.tex", keep(Dwalk_center_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, PC) nonotes

	
restore

****


*Table A7. District FE

*add district FE (by adding dummies)	
tab district	
unique school_id_cluster if district=="NA"
tab district, gen(dist)	
drop dist1

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
global controls_walk3="akp_pc_2009_belmeclis time_walk_min_2009_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk dist2-dist38 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a7.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Baseline Controls, NO, District FE, YES, Elec2009, MC) nonotes 

reg Dakp_3 Dwalk_3 $controls_walk3 dist2-dist38 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a7.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, District FE, YES, Elec2009, MC) nonotes 
		
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
global controls_walk3="akp_pc_2009_ilgenel time_walk_min_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_5 $controls_walk dist2-dist38 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a7.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, District FE, YES, Elec2009, PC) nonotes 
	
reg Dakp_5 Dwalk_5 $controls_walk3 dist2-dist38 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a7.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, District FE, YES, Elec2009, PC) nonotes 

****

* Table A8. Robustness regressions controling for 2007 AKP vote share

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk akp_pc_2007  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a8.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_3 $controls_walk akp_pc_2007  if year<2014, cluster(rn)
outreg2 using "$output/table_a8.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Cluster, Neighborhood, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_center_3 $controls_walk akp_pc_2007 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a8.tex", keep(Dwalk_center_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Cluster, Poll Station, Elec2009, MC) nonotes	
	
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
global controls_walk3="akp_pc_2009_ilgenel time_walk_min_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
	
reg Dakp_5 Dwalk_5 $controls_walk akp_pc_2007 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a8.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Cluster, Poll Station, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_5 $controls_walk akp_pc_2007 if year<2014, cluster(rn)
outreg2 using "$output/table_a8.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Cluster, Neighborhood, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_center_5 $controls_walk akp_pc_2007 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a8.tex", keep(Dwalk_center_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Cluster, Poll Station, Elec2009, PC) nonotes

****

*Table A9. Control for pre-existing need

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk4="akp_pc_2009_belmeclis time_walk_min_2009_belmeclis pop_inst_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk4 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a9.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, MC) nonotes 
	
global controls_walk4="akp_pc_2009_belmeclis walk_center_2009_belmeclis pop_inst_center_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
	
reg Dakp_3 Dwalk_center_3 $controls_walk4 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a9.tex", keep(Dwalk_center_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, MC) nonotes 
	
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk4="akp_pc_2009_ilgenel time_walk_min_2009_ilgenel pop_inst_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_5 $controls_walk4 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a9.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, PC) nonotes 
	
global controls_walk4="akp_pc_2009_ilgenel walk_center_2009_ilgenel pop_inst_center_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_center_5 $controls_walk4 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a9.tex", keep(Dwalk_center_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, PC) nonotes 
	
****
	
* Table A10: Test reverse causality using only new FHC's (where walking time decreased)


*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
tab treated_3 if year==2011

reg Dwalk_3 Dakp_2009_belmeclis $controls_walk if treated_3==1 & year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a10.tex", keep(Dakp_2009_belmeclis) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 

reg Dwalk_3 Dakpmargin_2009_belmeclis $controls_walk if treated_3==1 & year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a10.tex", keep(Dakpmargin_2009_belmeclis) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 
		
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
tab treated_5 if year==2011
	
reg Dwalk_5 Dakp_2009_ilgenel $controls_walk if treated_5==1 & year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a10.tex", keep(Dakp_2009_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 

reg Dwalk_5 Dakpmargin_2009_ilgenel $controls_walk if treated_5==1 & year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a10.tex", keep(Dakpmargin_2009_ilgenel) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 

****

* Table A11. Placebo Regressions
*Replicate Table 2 with 2014 and 2015

*elec_combo=1 2009mayor,2011,2014mayor,2015june
global controls_walk="Dpopulation_1 Duniversity_1 Dhospital_pri_1 Dhospital_pub_1 Dodr_1 Dydr_1 medrayic09"

reg Dakp_1 Dwalk_1 $controls_walk if year==2014, cluster(school_id_cluster)
outreg2 using "$output/table_a11.tex", keep(Dwalk_1) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, None, Elec2011, General, Elec2014, Mayor) nonotes

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk if year==2014, cluster(school_id_cluster)
outreg2 using "$output/table_a11.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, None, Elec2011, General, Elec2014, MC) nonotes
				
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_5 $controls_walk if year==2014, cluster(school_id_cluster)
outreg2 using "$output/table_a11.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, None, Elec2011, General, Elec2014, PC) nonotes


****

*Table A12. Placebo Regressions: Lag-Lead Analysis

*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_2009_belmeclis Dwalk_3 $controls_walk if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a12.tex", keep(Dwalk_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 

reg Dakp_2009_belmeclis Dpop1000_asm_dr_3 $controls_walk if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a12.tex", keep(Dpop1000_asm_dr_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, MC) nonotes 
		
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
reg Dakp_2009_ilgenel Dwalk_5 $controls_walk if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a12.tex", keep(Dwalk_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 		
		
reg Dakp_2009_ilgenel Dpop1000_asm_dr_5 $controls_walk if year==2011, cluster(school_id_cluster)
outreg2 using "$output/table_a12.tex", keep(Dpop1000_asm_dr_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Elec2009, PC) nonotes 

	
****

*Table A13. Regressions with Dwalk and lograyic

*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june

reg Dwalk_5 lograyic09 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a13.tex", keep(lograyic09) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, NO, Baseline Controls, NO, Elec2009, PC) nonotes

reg Dwalk_5 lograyic09 akp_pc_2009_ilgenel pop_asm_2009_ilgenel dr_number_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_3 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a13.tex", keep(lograyic09) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, PC) nonotes

reg Dwalk_5 lograyic09 akp_pc_2007 pop_asm_2009_ilgenel dr_number_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_3 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a13.tex", keep(lograyic09) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Elec2009, PC) nonotes
	
reg Dwalk_center_5 lograyic09 akp_pc_2009_ilgenel pop_asm_2009_ilgenel dr_number_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_3 if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a13.tex", keep(lograyic09) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Elec2009, PC) nonotes

****

* Table A14. Full-fledged Results	
	
*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
global controls_walk3="akp_pc_2009_belmeclis time_walk_min_2009_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_3 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) replace ///
	addtext(Baseline Controls, NO, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_3 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, NO, Cluster, Neighborhood, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_3 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, YES, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_center_3 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, NO, Cluster, Poll Station, Elec2009, MC) nonotes
	
*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
global controls_walk3="akp_pc_2009_ilgenel time_walk_min_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_5 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, NO, Cluster, Poll Station, Elec2009, PC) nonotes

reg Dakp_5 Dwalk_5 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, NO, Cluster, Neighborhood, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_5 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, YES, Cluster, Poll Station, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_center_5 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a14.tex", bdec(3) nocons label tex(frag) append ///
	addtext(Baseline Controls, NO, Cluster, Poll Station, Elec2009, PC) nonotes


****
 
* Table A15. produced in Rscript


******
	
*Table A5. Alternative walking time measure

*load data
use "alternative_data.dta", clear 

summ
tab electionType

*labels for tables
la var Dwalk_alt_3 "$\Delta$ Walking time"
la var Dwalk_alt_5 "$\Delta$ Walking time"

la var Dakp_3 "$\Delta$ AKP vote share"
la var Dakp_5 "$\Delta$ AKP vote share"

la var lograyic09 "PropertyValue2009"


*elec_combo=3: 2009belmeclis,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"
global controls_walk3="akp_pc_2009_belmeclis walk_alternative_2009_belmeclis Dpopulation_3 Duniversity_3 Dhospital_pri_3 Dhospital_pub_3 Dodr_3 Dydr_3 medrayic09"

reg Dakp_3 Dwalk_alt_3 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_3) bdec(3) nocons label tex(frag) replace ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_alt_3 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Neighborhood, Elec2009, MC) nonotes

reg Dakp_3 Dwalk_alt_3 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_3) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Cluster, Poll Station, Elec2009, MC) nonotes

	*elec_combo=5: 2009ilgenel,2011,2014belmeclis,2015june
global controls_walk="Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"
global controls_walk3="akp_pc_2009_ilgenel walk_alternative_2009_ilgenel Dpopulation_5 Duniversity_5 Dhospital_pri_5 Dhospital_pub_5 Dodr_5 Dydr_5 medrayic09"

reg Dakp_5 Dwalk_alt_5 $controls_walk  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Poll Station, Elec2009, PC) nonotes

reg Dakp_5 Dwalk_alt_5 $controls_walk  if year<2014, cluster(rn)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, NO, Cluster, Neighborhood, Elec2009, PC) nonotes
	
reg Dakp_5 Dwalk_alt_5 $controls_walk3  if year<2014, cluster(school_id_cluster)
outreg2 using "$output/table_a5.tex", keep(Dwalk_alt_5) bdec(3) nocons label tex(frag) append ///
	addtext(Covariates, YES, Baseline Controls, YES, Cluster, Poll Station, Elec2009, PC) nonotes


******

	
log close 	

























